/**
 * Copyright (c) 2015, 2016 itemis AG (http://www.itemis.eu) and others.
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0.
 * 
 * SPDX-License-Identifier: EPL-2.0
 */
package org.eclipse.xtend.core.tests.java8.compiler;

import org.eclipse.xtend.core.tests.compiler.AbstractXtendCompilerTest;
import org.eclipse.xtend.core.tests.java8.Java8RuntimeInjectorProvider;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.testing.InjectWith;
import org.junit.Test;

/**
 * @author Sebastian Zarnekow - Initial contribution and API
 */
@InjectWith(Java8RuntimeInjectorProvider.class)
@SuppressWarnings("all")
public class CompilerBug458010Test extends AbstractXtendCompilerTest {
  @Test
  public void test_01() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import java.time.LocalDate");
    _builder.newLine();
    _builder.append("import java.time.Period");
    _builder.newLine();
    _builder.append("import java.util.function.Consumer");
    _builder.newLine();
    _builder.append("import java.util.function.Function");
    _builder.newLine();
    _builder.append("import java.util.function.IntConsumer");
    _builder.newLine();
    _builder.append("import java.util.function.Predicate");
    _builder.newLine();
    _builder.append("import org.eclipse.xtend.lib.annotations.Accessors");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import static Demo.Person.Sex.*");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Demo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Person {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("public enum Sex {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("MALE, FEMALE");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String name;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("LocalDate birthday;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("Sex gender;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String emailAddress;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("def getAge() {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("Period.between(birthday, LocalDate.now).years");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def static void main(String[] args) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("val roster = <Person>newArrayList");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("roster.processElements(");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append("[gender == MALE && age >= 18 && age <= 25],");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append("[emailAddress],");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append("[println(it)]");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append(")");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static def <X, Y> void processElements(");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append("Iterable<X> source,");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append("Predicate<X> tester,");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append("Function <X, Y> mapper,");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append("Consumer<Y> block) {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import com.google.common.base.Objects;");
    _builder_1.newLine();
    _builder_1.append("import java.time.LocalDate;");
    _builder_1.newLine();
    _builder_1.append("import java.time.Period;");
    _builder_1.newLine();
    _builder_1.append("import java.util.ArrayList;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Consumer;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Function;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Predicate;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.lib.annotations.Accessors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.InputOutput;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Pure;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Demo {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Person {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public enum Sex {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("MALE,");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("FEMALE;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String name;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private LocalDate birthday;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private Demo.Person.Sex gender;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String emailAddress;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public int getAge() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Period.between(this.birthday, LocalDate.now()).getYears();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getName() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setName(final String name) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.name = name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public LocalDate getBirthday() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setBirthday(final LocalDate birthday) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.birthday = birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public Demo.Person.Sex getGender() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setGender(final Demo.Person.Sex gender) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.gender = gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getEmailAddress() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setEmailAddress(final String emailAddress) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.emailAddress = emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static void main(final String[] args) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final ArrayList<Demo.Person> roster = CollectionLiterals.<Demo.Person>newArrayList();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Predicate<Demo.Person> _function = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return ((Objects.equal(it.gender, Demo.Person.Sex.MALE) && (it.getAge() >= 18)) && (it.getAge() <= 25));");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function<Demo.Person, String> _function_1 = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Consumer<String> _function_2 = (String it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("InputOutput.<String>println(it);");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("Demo.<Demo.Person, String>processElements(roster, _function, _function_1, _function_2);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static <X extends Object, Y extends Object> void processElements(final Iterable<X> source, final Predicate<X> tester, final Function<X, Y> mapper, final Consumer<Y> block) {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_02() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import java.time.LocalDate");
    _builder.newLine();
    _builder.append("import java.time.Period");
    _builder.newLine();
    _builder.append("import org.eclipse.xtend.lib.annotations.Accessors");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import static Demo.Person.Sex.*");
    _builder.newLine();
    _builder.append("class Demo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Person {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("public enum Sex {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("MALE, FEMALE");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String name;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("LocalDate birthday;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("Sex gender;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String emailAddress;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("def getAge() {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("Period.between(birthday, LocalDate.now).years");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def static void main(String[] args) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("val roster = <Person>newArrayList");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("roster");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append(".stream");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".filter[gender == MALE && age >= 18 && age <= 25]");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".map[emailAddress]");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".forEach[println(it)]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import com.google.common.base.Objects;");
    _builder_1.newLine();
    _builder_1.append("import java.time.LocalDate;");
    _builder_1.newLine();
    _builder_1.append("import java.time.Period;");
    _builder_1.newLine();
    _builder_1.append("import java.util.ArrayList;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Consumer;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Function;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Predicate;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.lib.annotations.Accessors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.InputOutput;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Pure;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Demo {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Person {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public enum Sex {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("MALE,");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("FEMALE;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String name;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private LocalDate birthday;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private Demo.Person.Sex gender;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String emailAddress;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public int getAge() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Period.between(this.birthday, LocalDate.now()).getYears();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getName() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setName(final String name) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.name = name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public LocalDate getBirthday() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setBirthday(final LocalDate birthday) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.birthday = birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public Demo.Person.Sex getGender() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setGender(final Demo.Person.Sex gender) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.gender = gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getEmailAddress() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setEmailAddress(final String emailAddress) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.emailAddress = emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static void main(final String[] args) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final ArrayList<Demo.Person> roster = CollectionLiterals.<Demo.Person>newArrayList();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Predicate<Demo.Person> _function = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return ((Objects.equal(it.gender, Demo.Person.Sex.MALE) && (it.getAge() >= 18)) && (it.getAge() <= 25));");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function<Demo.Person, String> _function_1 = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Consumer<String> _function_2 = (String it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("InputOutput.<String>println(it);");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("roster.stream().filter(_function).<String>map(_function_1).forEach(_function_2);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_03() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import java.time.LocalDate");
    _builder.newLine();
    _builder.append("import java.time.Period");
    _builder.newLine();
    _builder.append("import org.eclipse.xtend.lib.annotations.Accessors");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import static Demo.Person.Sex.*");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Demo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Person {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("public enum Sex {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("MALE, FEMALE");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String name;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("LocalDate birthday;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("Sex gender;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String emailAddress;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("def getAge() {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("Period.between(birthday, LocalDate.now).years");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def static void main(String[] args) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("val roster = <Person>newArrayList");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("roster");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append(".filter[gender == MALE && age >= 18 && age <= 25]");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append(".map[emailAddress]");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append(".forEach[println(it)]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import com.google.common.base.Objects;");
    _builder_1.newLine();
    _builder_1.append("import java.time.LocalDate;");
    _builder_1.newLine();
    _builder_1.append("import java.time.Period;");
    _builder_1.newLine();
    _builder_1.append("import java.util.ArrayList;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Consumer;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.lib.annotations.Accessors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Functions.Function1;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.InputOutput;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.IterableExtensions;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Pure;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Demo {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Person {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public enum Sex {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("MALE,");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("FEMALE;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String name;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private LocalDate birthday;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private Demo.Person.Sex gender;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String emailAddress;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public int getAge() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Period.between(this.birthday, LocalDate.now()).getYears();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getName() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setName(final String name) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.name = name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public LocalDate getBirthday() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setBirthday(final LocalDate birthday) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.birthday = birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public Demo.Person.Sex getGender() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setGender(final Demo.Person.Sex gender) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.gender = gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getEmailAddress() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setEmailAddress(final String emailAddress) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.emailAddress = emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static void main(final String[] args) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final ArrayList<Demo.Person> roster = CollectionLiterals.<Demo.Person>newArrayList();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function1<Demo.Person, Boolean> _function = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Boolean.valueOf(((Objects.equal(it.gender, Demo.Person.Sex.MALE) && (it.getAge() >= 18)) && (it.getAge() <= 25)));");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function1<Demo.Person, String> _function_1 = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Consumer<String> _function_2 = (String it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("InputOutput.<String>println(it);");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("IterableExtensions.<Demo.Person, String>map(IterableExtensions.<Demo.Person>filter(roster, _function), _function_1).forEach(_function_2);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_04() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import java.time.LocalDate");
    _builder.newLine();
    _builder.append("import java.time.Period");
    _builder.newLine();
    _builder.append("import org.eclipse.xtend.lib.annotations.Accessors");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import static Demo.Person.Sex.*");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Demo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Person {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("public enum Sex {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("MALE, FEMALE");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String name;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("LocalDate birthday;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("Sex gender;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String emailAddress;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("def getAge() {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("Period.between(birthday, LocalDate.now).years");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def static void main(String[] args) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("val roster = <Person>newArrayList");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("roster");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".stream");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".filter[gender == MALE]");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".mapToInt[age]");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".average");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".getAsDouble");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import com.google.common.base.Objects;");
    _builder_1.newLine();
    _builder_1.append("import java.time.LocalDate;");
    _builder_1.newLine();
    _builder_1.append("import java.time.Period;");
    _builder_1.newLine();
    _builder_1.append("import java.util.ArrayList;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Predicate;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.ToIntFunction;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.lib.annotations.Accessors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Pure;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Demo {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Person {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public enum Sex {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("MALE,");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("FEMALE;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String name;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private LocalDate birthday;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private Demo.Person.Sex gender;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String emailAddress;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public int getAge() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Period.between(this.birthday, LocalDate.now()).getYears();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getName() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setName(final String name) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.name = name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public LocalDate getBirthday() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setBirthday(final LocalDate birthday) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.birthday = birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public Demo.Person.Sex getGender() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setGender(final Demo.Person.Sex gender) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.gender = gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getEmailAddress() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setEmailAddress(final String emailAddress) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.emailAddress = emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static void main(final String[] args) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final ArrayList<Demo.Person> roster = CollectionLiterals.<Demo.Person>newArrayList();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Predicate<Demo.Person> _function = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Objects.equal(it.gender, Demo.Person.Sex.MALE);");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final ToIntFunction<Demo.Person> _function_1 = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.getAge();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("roster.stream().filter(_function).mapToInt(_function_1).average().getAsDouble();");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_05() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import java.time.LocalDate");
    _builder.newLine();
    _builder.append("import java.time.Period");
    _builder.newLine();
    _builder.append("import java.util.stream.Collectors");
    _builder.newLine();
    _builder.append("import org.eclipse.xtend.lib.annotations.Accessors");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import static Demo.Person.Sex.*");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Demo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Person {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("public enum Sex {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("MALE, FEMALE");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String name;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("LocalDate birthday;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("Sex gender;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String emailAddress;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("def getAge() {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("Period.between(birthday, LocalDate.now).years");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def static void main(String[] args) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("val roster = <Person>newArrayList");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("roster");
    _builder.newLine();
    _builder.append("\t\t   ");
    _builder.append(".stream");
    _builder.newLine();
    _builder.append("\t\t   ");
    _builder.append(".map[age]");
    _builder.newLine();
    _builder.append("\t\t   ");
    _builder.append(".reduce(0) [$0 + $1]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.time.LocalDate;");
    _builder_1.newLine();
    _builder_1.append("import java.time.Period;");
    _builder_1.newLine();
    _builder_1.append("import java.util.ArrayList;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.BinaryOperator;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Function;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.lib.annotations.Accessors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Pure;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Demo {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Person {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public enum Sex {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("MALE,");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("FEMALE;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String name;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private LocalDate birthday;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private Demo.Person.Sex gender;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String emailAddress;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public int getAge() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Period.between(this.birthday, LocalDate.now()).getYears();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getName() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setName(final String name) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.name = name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public LocalDate getBirthday() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setBirthday(final LocalDate birthday) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.birthday = birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public Demo.Person.Sex getGender() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setGender(final Demo.Person.Sex gender) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.gender = gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getEmailAddress() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setEmailAddress(final String emailAddress) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.emailAddress = emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static void main(final String[] args) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final ArrayList<Demo.Person> roster = CollectionLiterals.<Demo.Person>newArrayList();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function<Demo.Person, Integer> _function = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Integer.valueOf(it.getAge());");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final BinaryOperator<Integer> _function_1 = (Integer $0, Integer $1) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Integer.valueOf((($0).intValue() + ($1).intValue()));");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("roster.stream().<Integer>map(_function).reduce(Integer.valueOf(0), _function_1);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_06_a() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import java.time.LocalDate");
    _builder.newLine();
    _builder.append("import java.time.Period");
    _builder.newLine();
    _builder.append("import java.util.function.IntConsumer");
    _builder.newLine();
    _builder.append("import org.eclipse.xtend.lib.annotations.Accessors");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import static Demo.Person.Sex.*");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Demo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Averager implements IntConsumer {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("int total = 0");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("int count = 0");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("def average() {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("if (count > 0) (total as double) / count else 0");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("override accept(int i) {");
    _builder.newLine();
    _builder.append("\t    \t");
    _builder.append("total += i");
    _builder.newLine();
    _builder.append("\t    \t");
    _builder.append("count++");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("def combine(Averager other) {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("total += other.total");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("count += other.count");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Person {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("public enum Sex {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("MALE, FEMALE");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String name;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("LocalDate birthday;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("Sex gender;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String emailAddress;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("def getAge() {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("Period.between(birthday, LocalDate.now).years");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def static void main(String[] args) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("val roster = <Person>newArrayList");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("roster");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append(".stream");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".filter[gender == MALE]");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".map[age]");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".collect(");
    _builder.newLine();
    _builder.append("\t\t    \t");
    _builder.append("[new Averager],");
    _builder.newLine();
    _builder.append("\t\t    \t");
    _builder.append("[avg, i | avg.accept(i)],          // alternative: [$0.accept($1)]");
    _builder.newLine();
    _builder.append("\t\t    \t");
    _builder.append("[avg1, avg2 | avg1.combine(avg2)]) // alternative: [$0.combine($1)]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import com.google.common.base.Objects;");
    _builder_1.newLine();
    _builder_1.append("import java.time.LocalDate;");
    _builder_1.newLine();
    _builder_1.append("import java.time.Period;");
    _builder_1.newLine();
    _builder_1.append("import java.util.ArrayList;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.BiConsumer;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Function;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.IntConsumer;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Predicate;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Supplier;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.lib.annotations.Accessors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Pure;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Demo {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Averager implements IntConsumer {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private int total = 0;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private int count = 0;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public double average() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("double _xifexpression = (double) 0;");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("if ((this.count > 0)) {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("_xifexpression = (((double) this.total) / this.count);");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("} else {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("_xifexpression = 0;");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return _xifexpression;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Override");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void accept(final int i) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("int _tal = this.total;");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.total = (_tal + i);");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.count++;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public int combine(final Demo.Averager other) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("int _xblockexpression = (int) 0;");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("{");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("int _tal = this.total;");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("this.total = (_tal + other.total);");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("int _count = this.count;");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("_xblockexpression = this.count = (_count + other.count);");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return _xblockexpression;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Person {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public enum Sex {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("MALE,");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("FEMALE;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String name;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private LocalDate birthday;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private Demo.Person.Sex gender;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String emailAddress;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public int getAge() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Period.between(this.birthday, LocalDate.now()).getYears();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getName() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setName(final String name) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.name = name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public LocalDate getBirthday() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setBirthday(final LocalDate birthday) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.birthday = birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public Demo.Person.Sex getGender() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setGender(final Demo.Person.Sex gender) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.gender = gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getEmailAddress() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setEmailAddress(final String emailAddress) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.emailAddress = emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static void main(final String[] args) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final ArrayList<Demo.Person> roster = CollectionLiterals.<Demo.Person>newArrayList();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Predicate<Demo.Person> _function = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Objects.equal(it.gender, Demo.Person.Sex.MALE);");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function<Demo.Person, Integer> _function_1 = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Integer.valueOf(it.getAge());");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Supplier<Demo.Averager> _function_2 = () -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return new Demo.Averager();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final BiConsumer<Demo.Averager, Integer> _function_3 = (Demo.Averager avg, Integer i) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("avg.accept((i).intValue());");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final BiConsumer<Demo.Averager, Demo.Averager> _function_4 = (Demo.Averager avg1, Demo.Averager avg2) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("avg1.combine(avg2);");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("roster.stream().filter(_function).<Integer>map(_function_1).<Demo.Averager>collect(_function_2, _function_3, _function_4);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_06_b() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import java.time.LocalDate");
    _builder.newLine();
    _builder.append("import java.time.Period");
    _builder.newLine();
    _builder.append("import java.util.function.IntConsumer");
    _builder.newLine();
    _builder.append("import org.eclipse.xtend.lib.annotations.Accessors");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import static Demo.Person.Sex.*");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Demo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Averager implements IntConsumer {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("int total = 0");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("int count = 0");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("def average() {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("if (count > 0) (total as double) / count else 0");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("override accept(int i) {");
    _builder.newLine();
    _builder.append("\t    \t");
    _builder.append("total += i");
    _builder.newLine();
    _builder.append("\t    \t");
    _builder.append("count++");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("def combine(Averager other) {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("total += other.total");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("count += other.count");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Person {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("public enum Sex {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("MALE, FEMALE");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String name;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("LocalDate birthday;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("Sex gender;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String emailAddress;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("def getAge() {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("Period.between(birthday, LocalDate.now).years");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def static void main(Person[] roster) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("roster");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append(".stream");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".filter[gender == MALE]");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".map[age]");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".collect(");
    _builder.newLine();
    _builder.append("\t\t    \t");
    _builder.append("[new Averager],");
    _builder.newLine();
    _builder.append("\t\t    \t");
    _builder.append("[$0.accept($1)],");
    _builder.newLine();
    _builder.append("\t\t    \t");
    _builder.append("[$0.combine($1)])");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import com.google.common.base.Objects;");
    _builder_1.newLine();
    _builder_1.append("import java.time.LocalDate;");
    _builder_1.newLine();
    _builder_1.append("import java.time.Period;");
    _builder_1.newLine();
    _builder_1.append("import java.util.List;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.BiConsumer;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Function;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.IntConsumer;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Predicate;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Supplier;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.lib.annotations.Accessors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Pure;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Demo {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Averager implements IntConsumer {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private int total = 0;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private int count = 0;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public double average() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("double _xifexpression = (double) 0;");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("if ((this.count > 0)) {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("_xifexpression = (((double) this.total) / this.count);");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("} else {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("_xifexpression = 0;");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return _xifexpression;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Override");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void accept(final int i) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("int _tal = this.total;");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.total = (_tal + i);");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.count++;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public int combine(final Demo.Averager other) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("int _xblockexpression = (int) 0;");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("{");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("int _tal = this.total;");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("this.total = (_tal + other.total);");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("int _count = this.count;");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("_xblockexpression = this.count = (_count + other.count);");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return _xblockexpression;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Person {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public enum Sex {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("MALE,");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("FEMALE;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String name;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private LocalDate birthday;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private Demo.Person.Sex gender;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String emailAddress;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public int getAge() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Period.between(this.birthday, LocalDate.now()).getYears();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getName() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setName(final String name) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.name = name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public LocalDate getBirthday() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setBirthday(final LocalDate birthday) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.birthday = birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public Demo.Person.Sex getGender() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setGender(final Demo.Person.Sex gender) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.gender = gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getEmailAddress() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setEmailAddress(final String emailAddress) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.emailAddress = emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static void main(final Demo.Person[] roster) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Predicate<Demo.Person> _function = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Objects.equal(it.gender, Demo.Person.Sex.MALE);");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function<Demo.Person, Integer> _function_1 = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Integer.valueOf(it.getAge());");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Supplier<Demo.Averager> _function_2 = () -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return new Demo.Averager();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final BiConsumer<Demo.Averager, Integer> _function_3 = (Demo.Averager $0, Integer $1) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("$0.accept(($1).intValue());");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final BiConsumer<Demo.Averager, Demo.Averager> _function_4 = (Demo.Averager $0, Demo.Averager $1) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("$0.combine($1);");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("((List<Demo.Person>)Conversions.doWrapArray(roster)).stream().filter(_function).<Integer>map(_function_1).<Demo.Averager>collect(_function_2, _function_3, _function_4);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_07() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import java.time.LocalDate");
    _builder.newLine();
    _builder.append("import java.time.Period");
    _builder.newLine();
    _builder.append("import java.util.stream.Collectors");
    _builder.newLine();
    _builder.append("import org.eclipse.xtend.lib.annotations.Accessors");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import static Demo.Person.Sex.*");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Demo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Person {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("public enum Sex {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("MALE, FEMALE");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String name;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("LocalDate birthday;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("Sex gender;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String emailAddress;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("def getAge() {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("Period.between(birthday, LocalDate.now).years");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def static void main(String[] args) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("val roster = <Person>newArrayList");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("roster");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".stream");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".filter[gender == MALE]");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".map[name]");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".collect(Collectors.toList)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import com.google.common.base.Objects;");
    _builder_1.newLine();
    _builder_1.append("import java.time.LocalDate;");
    _builder_1.newLine();
    _builder_1.append("import java.time.Period;");
    _builder_1.newLine();
    _builder_1.append("import java.util.ArrayList;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Function;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Predicate;");
    _builder_1.newLine();
    _builder_1.append("import java.util.stream.Collectors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.lib.annotations.Accessors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Pure;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Demo {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Person {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public enum Sex {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("MALE,");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("FEMALE;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String name;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private LocalDate birthday;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private Demo.Person.Sex gender;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String emailAddress;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public int getAge() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Period.between(this.birthday, LocalDate.now()).getYears();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getName() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setName(final String name) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.name = name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public LocalDate getBirthday() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setBirthday(final LocalDate birthday) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.birthday = birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public Demo.Person.Sex getGender() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setGender(final Demo.Person.Sex gender) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.gender = gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getEmailAddress() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setEmailAddress(final String emailAddress) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.emailAddress = emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static void main(final String[] args) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final ArrayList<Demo.Person> roster = CollectionLiterals.<Demo.Person>newArrayList();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Predicate<Demo.Person> _function = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Objects.equal(it.gender, Demo.Person.Sex.MALE);");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function<Demo.Person, String> _function_1 = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("roster.stream().filter(_function).<String>map(_function_1).collect(Collectors.<String>toList());");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_08_a() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import java.time.LocalDate");
    _builder.newLine();
    _builder.append("import java.time.Period");
    _builder.newLine();
    _builder.append("import java.util.stream.Collectors");
    _builder.newLine();
    _builder.append("import org.eclipse.xtend.lib.annotations.Accessors");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import static Demo.Person.Sex.*");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Demo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Person {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("public enum Sex {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("MALE, FEMALE");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String name;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("LocalDate birthday;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("Sex gender;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String emailAddress;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("def getAge() {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("Period.between(birthday, LocalDate.now).years");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def static void main(String[] args) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("val roster = <Person>newArrayList");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("val namesByGender = roster");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append(".stream");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append(".collect(");
    _builder.newLine();
    _builder.append("\t            ");
    _builder.append("Collectors.groupingBy(");
    _builder.newLine();
    _builder.append("\t                ");
    _builder.append("[gender],");
    _builder.newLine();
    _builder.append("\t                ");
    _builder.append("Collectors.mapping(");
    _builder.newLine();
    _builder.append("\t                    ");
    _builder.append("[Person p | p.name],");
    _builder.newLine();
    _builder.append("\t                    ");
    _builder.append("Collectors.toList)))");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.time.LocalDate;");
    _builder_1.newLine();
    _builder_1.append("import java.time.Period;");
    _builder_1.newLine();
    _builder_1.append("import java.util.ArrayList;");
    _builder_1.newLine();
    _builder_1.append("import java.util.List;");
    _builder_1.newLine();
    _builder_1.append("import java.util.Map;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Function;");
    _builder_1.newLine();
    _builder_1.append("import java.util.stream.Collectors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.lib.annotations.Accessors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Pure;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Demo {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Person {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public enum Sex {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("MALE,");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("FEMALE;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String name;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private LocalDate birthday;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private Demo.Person.Sex gender;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String emailAddress;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public int getAge() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Period.between(this.birthday, LocalDate.now()).getYears();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getName() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setName(final String name) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.name = name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public LocalDate getBirthday() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setBirthday(final LocalDate birthday) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.birthday = birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public Demo.Person.Sex getGender() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setGender(final Demo.Person.Sex gender) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.gender = gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getEmailAddress() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setEmailAddress(final String emailAddress) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.emailAddress = emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static void main(final String[] args) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final ArrayList<Demo.Person> roster = CollectionLiterals.<Demo.Person>newArrayList();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function<Demo.Person, Demo.Person.Sex> _function = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function<Demo.Person, String> _function_1 = (Demo.Person p) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return p.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Map<Demo.Person.Sex, List<String>> namesByGender = roster.stream().collect(");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("Collectors.groupingBy(_function, ");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Collectors.mapping(_function_1, ");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("Collectors.<String>toList())));");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_08_b() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import java.time.LocalDate");
    _builder.newLine();
    _builder.append("import java.time.Period");
    _builder.newLine();
    _builder.append("import java.util.stream.Collectors");
    _builder.newLine();
    _builder.append("import org.eclipse.xtend.lib.annotations.Accessors");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import static Demo.Person.Sex.*");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Demo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Person {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("public enum Sex {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("MALE, FEMALE");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String name;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("LocalDate birthday;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("Sex gender;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String emailAddress;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("def getAge() {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("Period.between(birthday, LocalDate.now).years");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def static void main(String[] args) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("val roster = <Person>newArrayList");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("val namesByGender = roster");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append(".stream");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append(".collect(");
    _builder.newLine();
    _builder.append("\t            ");
    _builder.append("Collectors.groupingBy(");
    _builder.newLine();
    _builder.append("\t                ");
    _builder.append("[gender],");
    _builder.newLine();
    _builder.append("\t                ");
    _builder.append("Collectors.mapping(");
    _builder.newLine();
    _builder.append("\t                    ");
    _builder.append("[p | p.name],");
    _builder.newLine();
    _builder.append("\t                    ");
    _builder.append("Collectors.toList)))");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.time.LocalDate;");
    _builder_1.newLine();
    _builder_1.append("import java.time.Period;");
    _builder_1.newLine();
    _builder_1.append("import java.util.ArrayList;");
    _builder_1.newLine();
    _builder_1.append("import java.util.List;");
    _builder_1.newLine();
    _builder_1.append("import java.util.Map;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Function;");
    _builder_1.newLine();
    _builder_1.append("import java.util.stream.Collectors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.lib.annotations.Accessors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Pure;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Demo {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Person {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public enum Sex {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("MALE,");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("FEMALE;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String name;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private LocalDate birthday;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private Demo.Person.Sex gender;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String emailAddress;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public int getAge() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Period.between(this.birthday, LocalDate.now()).getYears();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getName() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setName(final String name) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.name = name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public LocalDate getBirthday() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setBirthday(final LocalDate birthday) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.birthday = birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public Demo.Person.Sex getGender() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setGender(final Demo.Person.Sex gender) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.gender = gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getEmailAddress() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setEmailAddress(final String emailAddress) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.emailAddress = emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static void main(final String[] args) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final ArrayList<Demo.Person> roster = CollectionLiterals.<Demo.Person>newArrayList();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function<Demo.Person, Demo.Person.Sex> _function = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function<Demo.Person, String> _function_1 = (Demo.Person p) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return p.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Map<Demo.Person.Sex, List<String>> namesByGender = roster.stream().collect(");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("Collectors.groupingBy(_function, ");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Collectors.mapping(_function_1, ");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("Collectors.<String>toList())));");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_09_a() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import java.time.LocalDate");
    _builder.newLine();
    _builder.append("import java.time.Period");
    _builder.newLine();
    _builder.append("import java.util.stream.Collectors");
    _builder.newLine();
    _builder.append("import org.eclipse.xtend.lib.annotations.Accessors");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import static Demo.Person.Sex.*");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Demo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Person {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("public enum Sex {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("MALE, FEMALE");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String name;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("LocalDate birthday;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("Sex gender;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String emailAddress;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("def getAge() {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("Period.between(birthday, LocalDate.now).years");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def static void main(String[] args) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("val roster = <Person>newArrayList");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("roster");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append(".stream");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append(".collect(");
    _builder.newLine();
    _builder.append("\t            ");
    _builder.append("Collectors.groupingBy(");
    _builder.newLine();
    _builder.append("\t                ");
    _builder.append("[gender],                      ");
    _builder.newLine();
    _builder.append("\t                ");
    _builder.append("Collectors.<Person, Integer>reducing(");
    _builder.newLine();
    _builder.append("\t                    ");
    _builder.append("0,");
    _builder.newLine();
    _builder.append("\t                    ");
    _builder.append("[age],");
    _builder.newLine();
    _builder.append("\t                    ");
    _builder.append("[$0 + $1])))");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.time.LocalDate;");
    _builder_1.newLine();
    _builder_1.append("import java.time.Period;");
    _builder_1.newLine();
    _builder_1.append("import java.util.ArrayList;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.BinaryOperator;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Function;");
    _builder_1.newLine();
    _builder_1.append("import java.util.stream.Collectors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.lib.annotations.Accessors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Pure;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Demo {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Person {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public enum Sex {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("MALE,");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("FEMALE;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String name;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private LocalDate birthday;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private Demo.Person.Sex gender;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String emailAddress;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public int getAge() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Period.between(this.birthday, LocalDate.now()).getYears();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getName() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setName(final String name) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.name = name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public LocalDate getBirthday() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setBirthday(final LocalDate birthday) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.birthday = birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public Demo.Person.Sex getGender() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setGender(final Demo.Person.Sex gender) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.gender = gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getEmailAddress() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setEmailAddress(final String emailAddress) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.emailAddress = emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static void main(final String[] args) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final ArrayList<Demo.Person> roster = CollectionLiterals.<Demo.Person>newArrayList();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function<Demo.Person, Demo.Person.Sex> _function = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function<Demo.Person, Integer> _function_1 = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Integer.valueOf(it.getAge());");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final BinaryOperator<Integer> _function_2 = (Integer $0, Integer $1) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Integer.valueOf((($0).intValue() + ($1).intValue()));");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("roster.stream().collect(");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("Collectors.groupingBy(_function, ");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Collectors.<Demo.Person, Integer>reducing(");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("Integer.valueOf(0), _function_1, _function_2)));");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_09_b() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import java.time.LocalDate");
    _builder.newLine();
    _builder.append("import java.time.Period");
    _builder.newLine();
    _builder.append("import java.util.stream.Collectors");
    _builder.newLine();
    _builder.append("import org.eclipse.xtend.lib.annotations.Accessors");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import static Demo.Person.Sex.*");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Demo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Person {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("public enum Sex {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("MALE, FEMALE");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String name;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("LocalDate birthday;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("Sex gender;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String emailAddress;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("def getAge() {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("Period.between(birthday, LocalDate.now).years");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def static void main(String[] args) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("val roster = <Person>newArrayList");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("roster");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append(".stream");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append(".collect(");
    _builder.newLine();
    _builder.append("\t            ");
    _builder.append("Collectors.groupingBy(");
    _builder.newLine();
    _builder.append("\t                ");
    _builder.append("[gender],                      ");
    _builder.newLine();
    _builder.append("\t                ");
    _builder.append("Collectors.reducing(");
    _builder.newLine();
    _builder.append("\t                    ");
    _builder.append("0,");
    _builder.newLine();
    _builder.append("\t                    ");
    _builder.append("[age],");
    _builder.newLine();
    _builder.append("\t                    ");
    _builder.append("[$0 + $1])))");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.time.LocalDate;");
    _builder_1.newLine();
    _builder_1.append("import java.time.Period;");
    _builder_1.newLine();
    _builder_1.append("import java.util.ArrayList;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.BinaryOperator;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Function;");
    _builder_1.newLine();
    _builder_1.append("import java.util.stream.Collectors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.lib.annotations.Accessors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Pure;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Demo {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Person {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public enum Sex {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("MALE,");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("FEMALE;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String name;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private LocalDate birthday;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private Demo.Person.Sex gender;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String emailAddress;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public int getAge() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Period.between(this.birthday, LocalDate.now()).getYears();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getName() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setName(final String name) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.name = name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public LocalDate getBirthday() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setBirthday(final LocalDate birthday) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.birthday = birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public Demo.Person.Sex getGender() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setGender(final Demo.Person.Sex gender) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.gender = gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getEmailAddress() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setEmailAddress(final String emailAddress) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.emailAddress = emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static void main(final String[] args) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final ArrayList<Demo.Person> roster = CollectionLiterals.<Demo.Person>newArrayList();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function<Demo.Person, Demo.Person.Sex> _function = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function<Demo.Person, Integer> _function_1 = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Integer.valueOf(it.getAge());");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final BinaryOperator<Integer> _function_2 = (Integer $0, Integer $1) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Integer.valueOf((($0).intValue() + ($1).intValue()));");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("roster.stream().collect(");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("Collectors.groupingBy(_function, ");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Collectors.<Demo.Person, Integer>reducing(");
    _builder_1.newLine();
    _builder_1.append("          ");
    _builder_1.append("Integer.valueOf(0), _function_1, _function_2)));");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_10_a() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import java.time.LocalDate");
    _builder.newLine();
    _builder.append("import java.time.Period");
    _builder.newLine();
    _builder.append("import java.util.stream.Collectors");
    _builder.newLine();
    _builder.append("import org.eclipse.xtend.lib.annotations.Accessors");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import static Demo.Person.Sex.*");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Demo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Person {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("public enum Sex {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("MALE, FEMALE");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String name;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("LocalDate birthday;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("Sex gender;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String emailAddress;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("def getAge() {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("Period.between(birthday, LocalDate.now).years");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def static void main(String[] args) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("val roster = <Person>newArrayList");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("val averageAgeByGender = roster");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".stream");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".collect(");
    _builder.newLine();
    _builder.append("\t\t        ");
    _builder.append("Collectors.groupingBy(");
    _builder.newLine();
    _builder.append("\t\t            ");
    _builder.append("[gender],                      ");
    _builder.newLine();
    _builder.append("\t\t            ");
    _builder.append("Collectors.<Person>averagingInt[age]))");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.time.LocalDate;");
    _builder_1.newLine();
    _builder_1.append("import java.time.Period;");
    _builder_1.newLine();
    _builder_1.append("import java.util.ArrayList;");
    _builder_1.newLine();
    _builder_1.append("import java.util.Map;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Function;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.ToIntFunction;");
    _builder_1.newLine();
    _builder_1.append("import java.util.stream.Collectors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.lib.annotations.Accessors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Pure;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Demo {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Person {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public enum Sex {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("MALE,");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("FEMALE;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String name;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private LocalDate birthday;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private Demo.Person.Sex gender;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String emailAddress;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public int getAge() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Period.between(this.birthday, LocalDate.now()).getYears();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getName() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setName(final String name) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.name = name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public LocalDate getBirthday() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setBirthday(final LocalDate birthday) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.birthday = birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public Demo.Person.Sex getGender() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setGender(final Demo.Person.Sex gender) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.gender = gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getEmailAddress() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setEmailAddress(final String emailAddress) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.emailAddress = emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static void main(final String[] args) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final ArrayList<Demo.Person> roster = CollectionLiterals.<Demo.Person>newArrayList();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function<Demo.Person, Demo.Person.Sex> _function = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final ToIntFunction<Demo.Person> _function_1 = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.getAge();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Map<Demo.Person.Sex, Double> averageAgeByGender = roster.stream().collect(");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("Collectors.groupingBy(_function, ");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Collectors.<Demo.Person>averagingInt(_function_1)));");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_10_b() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import org.eclipse.xtend.lib.annotations.Accessors");
    _builder.newLine();
    _builder.append("import static java.util.stream.Collectors.*\t\t\t");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Demo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Person {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("public enum Sex {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("MALE, FEMALE");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("Sex gender;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("def getAge() {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("10");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def static void main(String[] args) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("val roster = <Person>newArrayList");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("roster");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".stream");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".collect(");
    _builder.newLine();
    _builder.append("\t\t        ");
    _builder.append("groupingBy(");
    _builder.newLine();
    _builder.append("\t\t            ");
    _builder.append("[gender],                      ");
    _builder.newLine();
    _builder.append("\t\t            ");
    _builder.append("averagingInt[age]))");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.ArrayList;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Function;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.ToIntFunction;");
    _builder_1.newLine();
    _builder_1.append("import java.util.stream.Collectors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.lib.annotations.Accessors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Pure;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Demo {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Person {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public enum Sex {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("MALE,");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("FEMALE;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private Demo.Person.Sex gender;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public int getAge() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return 10;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public Demo.Person.Sex getGender() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setGender(final Demo.Person.Sex gender) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.gender = gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static void main(final String[] args) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final ArrayList<Demo.Person> roster = CollectionLiterals.<Demo.Person>newArrayList();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function<Demo.Person, Demo.Person.Sex> _function = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final ToIntFunction<Demo.Person> _function_1 = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.getAge();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("roster.stream().collect(");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("Collectors.groupingBy(_function, ");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Collectors.<Demo.Person>averagingInt(_function_1)));");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_10_c() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import java.time.LocalDate");
    _builder.newLine();
    _builder.append("import java.time.Period");
    _builder.newLine();
    _builder.append("import org.eclipse.xtend.lib.annotations.Accessors");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import static java.util.stream.Collectors.*");
    _builder.newLine();
    _builder.append("import static Demo.Person.Sex.*");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Demo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Person {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("public enum Sex {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("MALE, FEMALE");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String name;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("LocalDate birthday;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("Sex gender;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String emailAddress;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("def getAge() {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("Period.between(birthday, LocalDate.now).years");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def static void main(Person[] roster) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("roster");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".stream");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".collect(");
    _builder.newLine();
    _builder.append("\t\t        ");
    _builder.append("groupingBy(");
    _builder.newLine();
    _builder.append("\t\t            ");
    _builder.append("[gender],                      ");
    _builder.newLine();
    _builder.append("\t\t            ");
    _builder.append("averagingInt[age]))");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.time.LocalDate;");
    _builder_1.newLine();
    _builder_1.append("import java.time.Period;");
    _builder_1.newLine();
    _builder_1.append("import java.util.List;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Function;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.ToIntFunction;");
    _builder_1.newLine();
    _builder_1.append("import java.util.stream.Collectors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.lib.annotations.Accessors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Pure;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Demo {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Person {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public enum Sex {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("MALE,");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("FEMALE;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String name;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private LocalDate birthday;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private Demo.Person.Sex gender;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String emailAddress;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public int getAge() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Period.between(this.birthday, LocalDate.now()).getYears();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getName() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setName(final String name) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.name = name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public LocalDate getBirthday() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setBirthday(final LocalDate birthday) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.birthday = birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public Demo.Person.Sex getGender() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setGender(final Demo.Person.Sex gender) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.gender = gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getEmailAddress() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setEmailAddress(final String emailAddress) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.emailAddress = emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static void main(final Demo.Person[] roster) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function<Demo.Person, Demo.Person.Sex> _function = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final ToIntFunction<Demo.Person> _function_1 = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.getAge();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("((List<Demo.Person>)Conversions.doWrapArray(roster)).stream().collect(");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("Collectors.groupingBy(_function, ");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Collectors.<Demo.Person>averagingInt(_function_1)));");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_10_d() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import java.time.LocalDate");
    _builder.newLine();
    _builder.append("import java.time.Period");
    _builder.newLine();
    _builder.append("import org.eclipse.xtend.lib.annotations.Accessors");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import static java.util.stream.Collectors.*\t\t\t");
    _builder.newLine();
    _builder.append("import static Demo.Person.Sex.*");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import static extension java.util.Arrays.*");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Demo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Person {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("public enum Sex {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("MALE, FEMALE");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String name;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("LocalDate birthday;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("Sex gender;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String emailAddress;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("def getAge() {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("Period.between(birthday, LocalDate.now).years");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def static void main(Person[] roster) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("roster");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".stream");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".collect(");
    _builder.newLine();
    _builder.append("\t\t        ");
    _builder.append("groupingBy(");
    _builder.newLine();
    _builder.append("\t\t            ");
    _builder.append("[gender],                      ");
    _builder.newLine();
    _builder.append("\t\t            ");
    _builder.append("averagingInt[age]))");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.time.LocalDate;");
    _builder_1.newLine();
    _builder_1.append("import java.time.Period;");
    _builder_1.newLine();
    _builder_1.append("import java.util.Arrays;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Function;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.ToIntFunction;");
    _builder_1.newLine();
    _builder_1.append("import java.util.stream.Collectors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.lib.annotations.Accessors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Pure;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Demo {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Person {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public enum Sex {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("MALE,");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("FEMALE;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String name;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private LocalDate birthday;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private Demo.Person.Sex gender;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String emailAddress;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public int getAge() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Period.between(this.birthday, LocalDate.now()).getYears();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getName() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setName(final String name) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.name = name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public LocalDate getBirthday() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setBirthday(final LocalDate birthday) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.birthday = birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public Demo.Person.Sex getGender() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setGender(final Demo.Person.Sex gender) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.gender = gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getEmailAddress() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setEmailAddress(final String emailAddress) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.emailAddress = emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static void main(final Demo.Person[] roster) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function<Demo.Person, Demo.Person.Sex> _function = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final ToIntFunction<Demo.Person> _function_1 = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.getAge();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("Arrays.<Demo.Person>stream(roster).collect(");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("Collectors.groupingBy(_function, ");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Collectors.<Demo.Person>averagingInt(_function_1)));");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_10_e() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import java.time.LocalDate");
    _builder.newLine();
    _builder.append("import java.time.Period");
    _builder.newLine();
    _builder.append("import java.util.stream.Collectors");
    _builder.newLine();
    _builder.append("import org.eclipse.xtend.lib.annotations.Accessors");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import static Demo.Person.Sex.*");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import static extension java.util.Arrays.*");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Demo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Person {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("public enum Sex {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("MALE, FEMALE");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String name;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("LocalDate birthday;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("Sex gender;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String emailAddress;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("def getAge() {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("Period.between(birthday, LocalDate.now).years");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def static void main(Person[] roster) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("roster");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".stream");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".collect(");
    _builder.newLine();
    _builder.append("\t\t        ");
    _builder.append("Collectors.groupingBy(");
    _builder.newLine();
    _builder.append("\t\t            ");
    _builder.append("[gender],                      ");
    _builder.newLine();
    _builder.append("\t\t            ");
    _builder.append("Collectors.<Person>averagingInt[age]))");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.time.LocalDate;");
    _builder_1.newLine();
    _builder_1.append("import java.time.Period;");
    _builder_1.newLine();
    _builder_1.append("import java.util.Arrays;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Function;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.ToIntFunction;");
    _builder_1.newLine();
    _builder_1.append("import java.util.stream.Collectors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.lib.annotations.Accessors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Pure;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Demo {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Person {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public enum Sex {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("MALE,");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("FEMALE;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String name;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private LocalDate birthday;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private Demo.Person.Sex gender;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String emailAddress;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public int getAge() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Period.between(this.birthday, LocalDate.now()).getYears();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getName() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setName(final String name) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.name = name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public LocalDate getBirthday() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setBirthday(final LocalDate birthday) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.birthday = birthday;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public Demo.Person.Sex getGender() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setGender(final Demo.Person.Sex gender) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.gender = gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getEmailAddress() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setEmailAddress(final String emailAddress) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.emailAddress = emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static void main(final Demo.Person[] roster) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function<Demo.Person, Demo.Person.Sex> _function = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final ToIntFunction<Demo.Person> _function_1 = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.getAge();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("Arrays.<Demo.Person>stream(roster).collect(");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("Collectors.groupingBy(_function, ");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("Collectors.<Demo.Person>averagingInt(_function_1)));");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_11_a() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import org.eclipse.xtend.lib.annotations.Accessors");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import static Demo.Person.Sex.*");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Demo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Person {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("public enum Sex {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("MALE, FEMALE");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String name;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("Sex gender;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String emailAddress;");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def static void main(String[] args) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("val roster = <Person>newArrayList");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("val namesOfMaleMembersXtend = roster");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".filter[gender == MALE]");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".map[name]");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".toList");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import com.google.common.base.Objects;");
    _builder_1.newLine();
    _builder_1.append("import java.util.ArrayList;");
    _builder_1.newLine();
    _builder_1.append("import java.util.List;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.lib.annotations.Accessors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Functions.Function1;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.IterableExtensions;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Pure;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Demo {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Person {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public enum Sex {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("MALE,");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("FEMALE;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String name;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private Demo.Person.Sex gender;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String emailAddress;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getName() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setName(final String name) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.name = name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public Demo.Person.Sex getGender() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setGender(final Demo.Person.Sex gender) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.gender = gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getEmailAddress() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setEmailAddress(final String emailAddress) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.emailAddress = emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static void main(final String[] args) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final ArrayList<Demo.Person> roster = CollectionLiterals.<Demo.Person>newArrayList();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function1<Demo.Person, Boolean> _function = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Boolean.valueOf(Objects.equal(it.gender, Demo.Person.Sex.MALE));");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function1<Demo.Person, String> _function_1 = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final List<String> namesOfMaleMembersXtend = IterableExtensions.<String>toList(IterableExtensions.<Demo.Person, String>map(IterableExtensions.<Demo.Person>filter(roster, _function), _function_1));");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_11_b() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import org.eclipse.xtend.lib.annotations.Accessors");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import static Demo.Person.Sex.*");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Demo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Person {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("public enum Sex {");
    _builder.newLine();
    _builder.append("\t        ");
    _builder.append("MALE, FEMALE");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String name;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("Sex gender;");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("String emailAddress;");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def static void main(Person[] roster) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("roster");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".filter[gender == MALE]");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".map[name]");
    _builder.newLine();
    _builder.append("\t\t    ");
    _builder.append(".toList");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import com.google.common.base.Objects;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.lib.annotations.Accessors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Functions.Function1;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.IterableExtensions;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Pure;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Demo {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Person {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public enum Sex {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("MALE,");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("FEMALE;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String name;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private Demo.Person.Sex gender;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String emailAddress;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getName() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setName(final String name) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.name = name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public Demo.Person.Sex getGender() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setGender(final Demo.Person.Sex gender) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.gender = gender;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getEmailAddress() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setEmailAddress(final String emailAddress) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.emailAddress = emailAddress;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static void main(final Demo.Person[] roster) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function1<Demo.Person, Boolean> _function = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Boolean.valueOf(Objects.equal(it.gender, Demo.Person.Sex.MALE));");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function1<Demo.Person, String> _function_1 = (Demo.Person it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("IterableExtensions.<String>toList(IterableExtensions.<Demo.Person, String>map(IterableExtensions.<Demo.Person>filter(((Iterable<Demo.Person>)Conversions.doWrapArray(roster)), _function), _function_1));");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_12_a() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import java.util.Collection");
    _builder.newLine();
    _builder.append("import java.util.Comparator");
    _builder.newLine();
    _builder.append("import java.util.stream.Collectors");
    _builder.newLine();
    _builder.append("import org.eclipse.xtend.lib.annotations.Accessors");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Demo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Album {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("String name");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("Collection<Track> tracks");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Track {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("int rating");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def static void main(String[] args) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("val albums = <Album>newArrayList");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("val sortedFavs = albums.stream");
    _builder.newLine();
    _builder.append("\t\t        ");
    _builder.append(".filter[tracks.stream.anyMatch[rating >= 4]]");
    _builder.newLine();
    _builder.append("\t\t        ");
    _builder.append(".sorted(Comparator.<Album, String>comparing[name])");
    _builder.newLine();
    _builder.append("\t\t        ");
    _builder.append(".collect(Collectors.toList)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.ArrayList;");
    _builder_1.newLine();
    _builder_1.append("import java.util.Collection;");
    _builder_1.newLine();
    _builder_1.append("import java.util.Comparator;");
    _builder_1.newLine();
    _builder_1.append("import java.util.List;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Function;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Predicate;");
    _builder_1.newLine();
    _builder_1.append("import java.util.stream.Collectors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.lib.annotations.Accessors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Pure;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Demo {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Album {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String name;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private Collection<Demo.Track> tracks;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getName() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setName(final String name) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.name = name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public Collection<Demo.Track> getTracks() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.tracks;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setTracks(final Collection<Demo.Track> tracks) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.tracks = tracks;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Track {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private int rating;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public int getRating() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.rating;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setRating(final int rating) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.rating = rating;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static void main(final String[] args) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final ArrayList<Demo.Album> albums = CollectionLiterals.<Demo.Album>newArrayList();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Predicate<Demo.Album> _function = (Demo.Album it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("final Predicate<Demo.Track> _function_1 = (Demo.Track it_1) -> {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return (it_1.rating >= 4);");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.tracks.stream().anyMatch(_function_1);");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function<Demo.Album, String> _function_1 = (Demo.Album it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final List<Demo.Album> sortedFavs = albums.stream().filter(_function).sorted(Comparator.<Demo.Album, String>comparing(_function_1)).collect(Collectors.<Demo.Album>toList());");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_12_b() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import java.util.Collection");
    _builder.newLine();
    _builder.append("import java.util.Comparator");
    _builder.newLine();
    _builder.append("import java.util.stream.Collectors");
    _builder.newLine();
    _builder.append("import org.eclipse.xtend.lib.annotations.Accessors");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Demo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Album {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("String name");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("Collection<Track> tracks");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Track {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("int rating");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def static void main(Album[] albums) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("albums.stream");
    _builder.newLine();
    _builder.append("\t\t        ");
    _builder.append(".filter[tracks.stream.anyMatch[rating >= 4]]");
    _builder.newLine();
    _builder.append("\t\t        ");
    _builder.append(".sorted(Comparator.<Album, String>comparing[name])");
    _builder.newLine();
    _builder.append("\t\t        ");
    _builder.append(".collect(Collectors.toList)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Collection;");
    _builder_1.newLine();
    _builder_1.append("import java.util.Comparator;");
    _builder_1.newLine();
    _builder_1.append("import java.util.List;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Function;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Predicate;");
    _builder_1.newLine();
    _builder_1.append("import java.util.stream.Collectors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.lib.annotations.Accessors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Pure;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Demo {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Album {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String name;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private Collection<Demo.Track> tracks;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getName() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setName(final String name) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.name = name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public Collection<Demo.Track> getTracks() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.tracks;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setTracks(final Collection<Demo.Track> tracks) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.tracks = tracks;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Track {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private int rating;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public int getRating() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.rating;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setRating(final int rating) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.rating = rating;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static void main(final Demo.Album[] albums) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Predicate<Demo.Album> _function = (Demo.Album it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("final Predicate<Demo.Track> _function_1 = (Demo.Track it_1) -> {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return (it_1.rating >= 4);");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.tracks.stream().anyMatch(_function_1);");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function<Demo.Album, String> _function_1 = (Demo.Album it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("((List<Demo.Album>)Conversions.doWrapArray(albums)).stream().filter(_function).sorted(Comparator.<Demo.Album, String>comparing(_function_1)).collect(Collectors.<Demo.Album>toList());");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_12_c() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import java.util.Collection");
    _builder.newLine();
    _builder.append("import java.util.Comparator");
    _builder.newLine();
    _builder.append("import java.util.stream.Collectors");
    _builder.newLine();
    _builder.append("import org.eclipse.xtend.lib.annotations.Accessors");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Demo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Album {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("String name");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("Collection<Track> tracks");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Track {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("int rating");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def static void main(String[] args) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("val albums = <Album>newArrayList");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("val sortedFavs = albums.stream");
    _builder.newLine();
    _builder.append("\t\t        ");
    _builder.append(".filter[tracks.stream.anyMatch[rating >= 4]]");
    _builder.newLine();
    _builder.append("\t\t        ");
    _builder.append(".sorted(Comparator.comparing[name])");
    _builder.newLine();
    _builder.append("\t\t        ");
    _builder.append(".collect(Collectors.toList)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.ArrayList;");
    _builder_1.newLine();
    _builder_1.append("import java.util.Collection;");
    _builder_1.newLine();
    _builder_1.append("import java.util.Comparator;");
    _builder_1.newLine();
    _builder_1.append("import java.util.List;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Function;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Predicate;");
    _builder_1.newLine();
    _builder_1.append("import java.util.stream.Collectors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.lib.annotations.Accessors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Pure;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Demo {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Album {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String name;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private Collection<Demo.Track> tracks;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getName() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setName(final String name) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.name = name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public Collection<Demo.Track> getTracks() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.tracks;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setTracks(final Collection<Demo.Track> tracks) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.tracks = tracks;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Track {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private int rating;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public int getRating() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.rating;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setRating(final int rating) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.rating = rating;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static void main(final String[] args) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final ArrayList<Demo.Album> albums = CollectionLiterals.<Demo.Album>newArrayList();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Predicate<Demo.Album> _function = (Demo.Album it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("final Predicate<Demo.Track> _function_1 = (Demo.Track it_1) -> {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return (it_1.rating >= 4);");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.tracks.stream().anyMatch(_function_1);");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function<Demo.Album, String> _function_1 = (Demo.Album it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final List<Demo.Album> sortedFavs = albums.stream().filter(_function).sorted(Comparator.<Demo.Album, String>comparing(_function_1)).collect(Collectors.<Demo.Album>toList());");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_12_d() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import java.util.Collection");
    _builder.newLine();
    _builder.append("import java.util.Comparator");
    _builder.newLine();
    _builder.append("import org.eclipse.xtend.lib.annotations.Accessors");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import static java.util.stream.Collectors.*");
    _builder.newLine();
    _builder.append("import static java.util.Comparator.*");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Demo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Album {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("String name");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("Collection<Track> tracks");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Track {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("int rating");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def static void main(Album[] albums) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("albums.stream");
    _builder.newLine();
    _builder.append("\t\t        ");
    _builder.append(".filter[tracks.stream.anyMatch[rating >= 4]]");
    _builder.newLine();
    _builder.append("\t\t        ");
    _builder.append(".sorted(comparing[name])");
    _builder.newLine();
    _builder.append("\t\t        ");
    _builder.append(".collect(toList)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Collection;");
    _builder_1.newLine();
    _builder_1.append("import java.util.Comparator;");
    _builder_1.newLine();
    _builder_1.append("import java.util.List;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Function;");
    _builder_1.newLine();
    _builder_1.append("import java.util.function.Predicate;");
    _builder_1.newLine();
    _builder_1.append("import java.util.stream.Collectors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.lib.annotations.Accessors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Pure;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Demo {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Album {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String name;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private Collection<Demo.Track> tracks;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getName() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setName(final String name) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.name = name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public Collection<Demo.Track> getTracks() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.tracks;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setTracks(final Collection<Demo.Track> tracks) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.tracks = tracks;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Track {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private int rating;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public int getRating() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.rating;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setRating(final int rating) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.rating = rating;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static void main(final Demo.Album[] albums) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Predicate<Demo.Album> _function = (Demo.Album it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("final Predicate<Demo.Track> _function_1 = (Demo.Track it_1) -> {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return (it_1.rating >= 4);");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.tracks.stream().anyMatch(_function_1);");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function<Demo.Album, String> _function_1 = (Demo.Album it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("((List<Demo.Album>)Conversions.doWrapArray(albums)).stream().filter(_function).sorted(Comparator.<Demo.Album, String>comparing(_function_1)).collect(Collectors.<Demo.Album>toList());");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_13_a() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import java.util.Collection");
    _builder.newLine();
    _builder.append("import org.eclipse.xtend.lib.annotations.Accessors");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Demo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Album {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("String name");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("Collection<Track> tracks");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Track {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("int rating");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def static void main(String[] args) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("val albums = <Album>newArrayList");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("albums.filter[tracks.exists[rating >= 4]].sortBy[name]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.ArrayList;");
    _builder_1.newLine();
    _builder_1.append("import java.util.Collection;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.lib.annotations.Accessors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.CollectionLiterals;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Functions.Function1;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.IterableExtensions;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Pure;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Demo {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Album {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String name;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private Collection<Demo.Track> tracks;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getName() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setName(final String name) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.name = name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public Collection<Demo.Track> getTracks() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.tracks;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setTracks(final Collection<Demo.Track> tracks) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.tracks = tracks;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Track {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private int rating;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public int getRating() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.rating;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setRating(final int rating) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.rating = rating;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static void main(final String[] args) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final ArrayList<Demo.Album> albums = CollectionLiterals.<Demo.Album>newArrayList();");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function1<Demo.Album, Boolean> _function = (Demo.Album it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("final Function1<Demo.Track, Boolean> _function_1 = (Demo.Track it_1) -> {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return Boolean.valueOf((it_1.rating >= 4));");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Boolean.valueOf(IterableExtensions.<Demo.Track>exists(it.tracks, _function_1));");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function1<Demo.Album, String> _function_1 = (Demo.Album it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("IterableExtensions.<Demo.Album, String>sortBy(IterableExtensions.<Demo.Album>filter(albums, _function), _function_1);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }

  @Test
  public void test_13_b() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import java.util.Collection");
    _builder.newLine();
    _builder.append("import org.eclipse.xtend.lib.annotations.Accessors");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Demo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Album {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("String name");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("Collection<Track> tracks");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Accessors");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Track {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("int rating");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def static void main(Album[] albums) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("albums.filter[tracks.exists[rating >= 4]].sortBy[name]");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import java.util.Collection;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtend.lib.annotations.Accessors;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Conversions;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Functions.Function1;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.IterableExtensions;");
    _builder_1.newLine();
    _builder_1.append("import org.eclipse.xtext.xbase.lib.Pure;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("@SuppressWarnings(\"all\")");
    _builder_1.newLine();
    _builder_1.append("public class Demo {");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Album {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private String name;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private Collection<Demo.Track> tracks;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public String getName() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setName(final String name) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.name = name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public Collection<Demo.Track> getTracks() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.tracks;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setTracks(final Collection<Demo.Track> tracks) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.tracks = tracks;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("@Accessors");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static class Track {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("private int rating;");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("@Pure");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public int getRating() {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return this.rating;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("public void setRating(final int rating) {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("this.rating = rating;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("public static void main(final Demo.Album[] albums) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function1<Demo.Album, Boolean> _function = (Demo.Album it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("final Function1<Demo.Track, Boolean> _function_1 = (Demo.Track it_1) -> {");
    _builder_1.newLine();
    _builder_1.append("        ");
    _builder_1.append("return Boolean.valueOf((it_1.rating >= 4));");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return Boolean.valueOf(IterableExtensions.<Demo.Track>exists(it.tracks, _function_1));");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("final Function1<Demo.Album, String> _function_1 = (Demo.Album it) -> {");
    _builder_1.newLine();
    _builder_1.append("      ");
    _builder_1.append("return it.name;");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("};");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("IterableExtensions.<Demo.Album, String>sortBy(IterableExtensions.<Demo.Album>filter(((Iterable<Demo.Album>)Conversions.doWrapArray(albums)), _function), _function_1);");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    this.assertCompilesTo(_builder, _builder_1);
  }
}
